<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>dataTable Creation</title>
</head>
<body>


	<%
	String _beanName     	= "beanName";
	//---------------------- title bar variable ----------------------//
	String _panelGroupId 	= "pGroupId";
	String _titleBarName 	= "titleName";
	String _render			= "";
	String _stopSignGroupNo	= "";
	//---------------------- table table header variable ----------------------//
	
	String _tableBean		= "artlEnquiryBean";
	String _tableValue		= "articleEnquiryList";
	String _tableRender		= "showResultPanel";
	String _tableSortColumn	= "ascending";
	String _tableSortAsc	= "rowPerPage";
	String _tableRows		= "rows";
	String _tableBinding	= "rowPerPage";
	String _tableResize		= "TRUE";
	String _styleClass		= "iceDatTblnoMar";
	
	//---------------------- dataTable content variable ----------------------//
	
String[] _linkValue={	"articleGrpName"	,""	,""	,""	};
String[] _linkAction={	"artlEnquiryBean.forwardProcess"	,""	,""	,""	};
String[] _linkRendered={	"artlEnquiryBean.masterArticleLink and !artlEnquiryBean.reassignArticle"	,""	,""	,""	};
String[] _linkParamValue={	"articleGrpId"	,""	,""	,""	};
String[] _textValue={	""	,""	,"age"	,""	};
String[] _labelValue={	""	,""	,""	,"schoolName"	};
String[] _areaValue={	""	,"pcvValue"	,""	,""	};
String[] _areaStyle={	""	,"inputXtraWide2 #{dvo.specValuesList[status.index].pcvValueCss}"	,""	,""	};
String[] _areaValidator={	""	,"asciiValidator"	,""	,""	};
%>
<!-- start generate -->
	<c:set var="module">
		<jsp:text>
			<![CDATA[
				<!-- @panelGroupId@ -->
				<ui:include src="../common/TitleBar.jspx">
					<ui:param name="tid" value="@panelGroupId@Title" />
					<ui:param name="panelGroupId" value="@panelGroupId@" />
					<ui:param name="titleBarName" value="#{@titleBarName@}" />
					<ui:param name="stopSignGroupNo" value="@stopSignGroupNo@" />
					<ui:param name="rendered" value="#{@beanName@.@render@}" />
				</ui:include>
				<!-- @tableValue@ dataTable -->
				<ice:panelGroup id="@panelGroupId@">
					<ice:dataTable	id="@tableValue@Table"
									value="#{@tableBean@.@tableValue@}"
									rendered="#{@tableBean@.@tableRender@}"
									sortColumn="#{@tableBean@.@tableRender@}"
									sortAscending="#{@tableBean@.@tableSortColumn@}"
									rows="#{@tableBean@.@tableRows@}"
									binding="#{@tableBean@.@tableBinding@}" 
									resizable="@tableResize@"
									styleClass="@styleClass@"
									var="bean"
									varStatus="status"
									border="1"	
									frame="border"
									>
									@dataTableList@
					</ice:dataTable	id="@tableValue@Table"			
				</ice:panelGroup id="@panelGroupId@">
			]]>
		</jsp:text>
	</c:set>

	<c:set var="textArea">
			<jsp:text>
				<![CDATA[
					
				
				]]>
			</jsp:text>
		</c:set>

	<c:set var="textArea">
		<jsp:text>
			<![CDATA[
				<ice:column>
					<f:facet name="header">
						<ice:@headerType@ value="#{@headerValue@}" />
					</f:facet>
					<ice:inputTextarea	id="@areaValue@"
										value="#{bean.@areaValue@}"
										styleClass="@areaStyle@" 
										onchange="processPageValueChange();">
										<f:validator validatorId="@areaValidator@" />
					</ice:inputTextarea>
					<ice:message	for="@areaValue@" 
									errorClass="errorMsg"
									infoClass="infoMsg"
									warnClass="warnMsg"
									fatalClass="fatalMsg"
									showDetail="false" 
									showSummary="true"/>
				</ice:column>	
			]]>
		</jsp:text>
	</c:set>
	<c:set var="comLink">
			<jsp:text>
				<![CDATA[
					<ice:column>
						<f:facet name="header">
							<ice:@headerType@t value="#{@headerValue@}" />
						</f:facet>
						<ice:commandLink	id="@linkValue@Link" 
											value="#{bean.@linkValue@}"
											action="#{@linkAction@}"
											rendered="#{@linkRendered@}">
											<f:param	name="@linkParamValue@" 
														value="#{bean.@linkParamValue@}"/>
						</ice:commandLink>
					</ice:column>
				]]>
			</jsp:text>
	</c:set>
	
	<c:set var="outText">
			<jsp:text>
				<![CDATA[
					<f:facet name="header">
						<ice:@headerType@ value="#{@headerValue@}" />
					</f:facet>
					<ice:column>
						<ice:outputText value="#{bean.@textValue@}" />
					</ice:column>
				]]>
			</jsp:text>
	</c:set>
	
	<c:set var="outLabel">
			<jsp:text>
				<![CDATA[
					<f:facet name="header">
						<ice:@headerType@ value="#{@headerValue@}" />
					</f:facet>
					<ice:column>
						<ice:outputLabel value="#{bean.@labelValue@}" />
					</ice:column>
				]]>
			</jsp:text>
	</c:set>

	<%
	//-----------------  to generate bar -------------------------//
	String _module=(String)pageContext.getAttribute("module");
	_module=_module.replaceAll("@panelGroupId@",_panelGroupId);
	_module=_module.replaceAll("@titleBarName@",_titleBarName);
	if (_render.equals(""))
		_module=_module.replaceAll("<ui.*render.*>","");
	else
		_module=_module.replaceAll("@render@",_render);
	if (_stopSignGroupNo.equals(""))
		_module=_module.replaceAll("<ui.*stopSignGroupNo.*>","");
	else
		_module=_module.replaceAll("@_stopSignGroupNo@",_stopSignGroupNo);
	
	

	
	//--------------------- for generate dataTable header----------------//
	_module=_module.replaceAll("@tableBean@",_tableBean);
	_module=_module.replaceAll("@tableValue@",_tableValue);
	if (_tableRender.equals(""))
		_module=_module.replaceAll("render=.*\"","");
	else
		_module=_module.replaceAll("@tableRender@",_tableRender);
	if (_tableSortColumn.equals(""))
		_module=_module.replaceAll("sortColumn=.*\"","");
	else
		_module=_module.replaceAll("@tableSortColumn@",_tableSortColumn);
	if (_tableSortAsc.equals(""))
		_module=_module.replaceAll("sortAscending=.*\"","");
	else
		_module=_module.replaceAll("@tableSortAsc@",_tableSortAsc);
	if (_tableRows.equals(""))
		_module=_module.replaceAll("rows=.*\"","");
	else
		_module=_module.replaceAll("@tableRows@",_tableRows);
	if (_tableBinding.equals(""))
		_module=_module.replaceAll("binding=.*\"","");
	else
		_module=_module.replaceAll("@tableBinding@",_tableBinding);
	if (_tableResize.equals(""))
		_module=_module.replaceAll("resizeable=.*\"","");
	else
		_module=_module.replaceAll("@tableResize@",_tableResize);
	if (_styleClass.equals(""))
		_module=_module.replaceAll("styleClass=.*\"","");
	else
		_module=_module.replaceAll("@styleClass@",_styleClass);
	
	String _dataTableList="";	
	for (int i=0;i<_linkValue.length;i++){
		String _content="";
		if (!_linkValue[i].equals("")){
			_content=(String)pageContext.getAttribute("comLink");
			_content=_content.replaceAll("@linkValue@",_linkValue[i]);
			_content=_content.replaceAll("@linkAction@",_linkAction[i]);
			if (_linkRendered[i].equals(""))
				_content=_module.replaceAll("rendered=.*\"","");
			else
				_content=_content.replaceAll("@linkRendered@",_linkRendered[i]);
			if (_linkParamValue[i].equals(""))
				_content=_module.replaceAll("<f:param.*/>","");
			else
				_content=_content.replaceAll("@linkParamValue@",_linkParamValue[i]);
		}
		if (!_areaValue[i].equals("")){
			_content=(String)pageContext.getAttribute("textArea");
			_content=_content.replaceAll("@areaValue@",_areaValue[i]);
			if (_areaStyle[i].equals(""))
				_content=_module.replaceAll("styleClass=.*>\"","");
			else
				_content=_content.replaceAll("@areaStyle@",_areaStyle[i]);
			if (_areaValidator[i].equals(""))
				_content=_module.replaceAll("f:validator.*/>","");
			else
				_content=_content.replaceAll("@areaValidator@",_areaValidator[i]);
			
		}
		if (!_textValue[i].equals("")){
			_content=(String)pageContext.getAttribute("outText");
			_content=_content.replaceAll("@textValue@",_textValue[i]);
		}
		if (!_labelValue[i].equals("")){
			_content=(String)pageContext.getAttribute("outLabel");
			_content=_content.replaceAll("@labelValue@",_labelValue[i]);
		}
		
		_dataTableList+=_content;
	}
	_module=_module.replaceAll("@dataTableList@",_dataTableList);
	
  	%>

	<pre>
		<c:out value="<%=_module%>" />
	</pre>
</body>
</html>